from django.urls import path
import views
from django.urls import converters

# 编写控制器
class MobleConverters:
    regex = '1[1-9]\d{9}'
    def to_python(self, value):
        return int(value)

# 注册
converters.register_converter(MobleConverters, 'moble')

urlpatterns = [
    path('index/', views.index),
   # path('<book_id>/<id>/', views.goods),
    # 表单数据
    path('froms/', views.froms),
    #　Json表单
    path('jsons/', views.Jsons),
    # 返回json数据

    path('json/', views.json_retuen),
    # 重定向
    path('rewite/', views.red),
    # 设置cookie
    path('cookie/', views.cookie),
    # 读取cookies
    path('read_cookie/', views.read_cookie),
    # delete cookie
    path('delete_cookie/', views.delete_cookie),
    # set_session
    path('set_session/', views.set_session),
    # get_session
    path('get_session/', views.get_session),
    # Moble_check_get
    path('moble_check/<moble:phone>/', views.Moble_Check.as_view()),
]